Hierarchical data structures may be used to represent user interfaces for computer programs. For example, a hierarchical data structure such as an Extensible Markup Language (“XML”) document may contain multiple elements, each representing some aspect of a user interface. For example, an element in a hierarchy might represent a menu bar such as is found in many graphical user interfaces. The menu bar element might have several child elements, such as an element for a “file” submenu, an element for an “edit” submenu, and an element for a “view” submenu, for example. Each of these elements might also have several child elements. For example, the file element might have child elements for “new,” “open,” “close,” and “save” operations.
Using such a hierarchical data structure as a guide, a computer program can automatically render a user interface for display. Often, it is much easier for a user interface designer to modify such a hierarchical data structure than to modify the source code of a computer program. Modifying a hierarchical data structure, as opposed to source code, typically requires less knowledge about computer programming languages, and provides fewer opportunities to introduce errors into a computer program.
Several different approaches may be practiced when modifying a hierarchical data structure. One approach uses XML-based User Interface Language (“XUL”) overlays. XUL overlays are XUL documents that specify one or more user interface elements that are to be inserted into an existing XUL document. XUL is a specialized version of XML that is designed specifically for describing user interfaces. A user interface designer can create an XUL overlay and provide both the XUL overlay and a target XUL document to a computer program that inserts, into the target XUL document, new user interface elements specified in the XUL overlay.
XUL overlays are not capable of specifying any modifications to an XUL document other than insertions of new user interface elements. XUL overlays are not capable of specifying modifications to hierarchical data structures other than XUL documents. New user interface elements specified in an XUL overlay are inserted into an XUL document as child elements of existing parent elements wherever such parent elements are found to have a specified element identifier, regardless of the level at which those parent element occur in the hierarchy of the XUL document. XUL overlays do not provide any other means of specifying where, in a target XUL document, a new user interface element should be inserted.
Another approach to modifying a hierarchical data structure uses XML Update Language (“XUpdate”) to specify, in XML, modifications that are to be made to a target XML document. XUpdate uses XML Path Language (“XPath”) to indicate where, in the target XML document's hierarchical structure, specified modifications are to be made.
Because)(Path expresses location references relative to the hierarchical structure of the target XML document, XUpdate will not apply a specified modification correctly if the hierarchical structure of the target document does not contain the exact hierarchical path specified in association with the modification. In many circumstances, the hierarchical structure of a target XML document is prone to frequent change.